function [L,key] = LineGraph(G)

upperG = triu(G);
p = sum(sum(upperG));
key = zeros(p,2);
keyIndex = 1;

for i=1:size(G)
    for j=1:size(G)
        if(upperG(j,i) == 1)
            key(keyIndex,1) = i;
            key(keyIndex,2) = j;
            keyIndex = keyIndex + 1;
        end
    end
end

L = zeros(p);

for i=1:p
    for j=1:p
        if(key(i,1) == key(j,1) && (i ~= j))
            L(i,j) = 1;
        end
        
        if((key(i,2) == key(j,1)) || (key(i,2) == key(j,2)) && (i ~= j))
            L(i,j) = 1;
        end
    end
end

L = cast((L | L'),'double');

            
            
    